<template>
	<view>
		<global-contact></global-contact>
		<!-- #ifdef MP-WEIXIN -->
		<view class="header">
		<!-- #endif -->
		<!-- #ifdef H5 -->
		<view class="header header-top-h5">
		<!-- #endif -->
			<view class="head">
				<image style="width: 30rpx;height: 30rpx;" src="https://www.atuanjian.com/appletStatic/static/local.png" mode=""></image>
				<view class="local" @click="chooseCity()">
					<text>{{currentCity.lastIndexOf('市')?currentCity.replace(/市/,""):currentCity}}</text>
					<view class="trang"></view>
				</view>
				<view class="search">
					<u-search @search="search()" placeholder="户外拓展/团建/骑行" :showAction="false" v-model="keyword"></u-search>
				</view> 
			</view>
		</view>
		
		<view class="content">
			<view class="swiper">
				<u-swiper
					:list="banner"
					@change="e => currentNum = e.current"
					:autoplay="false"
					height="400rpx"
					imgMode="aspectFill"
					:circular="true"
					indicatorStyle="right: 20px">
					<view slot="indicator" class="indicator-num">
					   <text class="indicator-num__text">{{ currentNum + 1 }}/{{ banner.length }}</text>
					</view>
				 </u-swiper>
			</view>
			<!-- nav -->
			<view class="navBar">
			  <swiper :indicator-dots="true" :autoplay="false" :interval="3000" :circular="true" :duration="1000">
			  	<swiper-item v-for="(item,index) in navList" :key="index">
			  		<view class="swiper-item" v-for="(item1,index1) in item" :key="index1" @click="toFound(item1)">
						<image :src="item1.applet_icon?showImg+item1.applet_icon:'https://www.atuanjian.com/appletStatic/static/fail.png'" mode="aspectFit"></image>
						<text>{{item1.text}}</text>
					</view>
			  	</swiper-item> 
			  </swiper>
			</view>
			
			<view class="selec">
				<view class="item">
					<text>分类：默认</text>
					<image src="https://www.atuanjian.com/appletStatic/static/duo.png" mode="aspectFit"></image>
				</view>
				<view class="item">
					<text>分类：默认</text>
					<image src="https://www.atuanjian.com/appletStatic/static/duo.png" mode="aspectFit"></image>
				</view>
				<view class="item">
					<text>分类：默认</text>
					<image src="https://www.atuanjian.com/appletStatic/static/duo.png" mode="aspectFit"></image>
				</view>
			</view>
			
			<view class="goodsList">
				<view class="item">
					<image src="https://www.atuanjian.com/appletStatic/static/t1.png" mode="aspectFill"></image>
					<view class="info">
						<view class="name">【赋能之旅】油画大师主题团建活团建活动动</view>
						<view class="time">报名时间：2022.02.04</view>
						<view class="time">活动地点：西安</view>
						<view class="bottom">
							<text>报名中</text>
							<view class="btn">我要报名</view>
						</view>
					</view>
				</view>
			</view>
			
		</view>
		
		<tabBar current='2'></tabBar>
	</view>
</template>

<script> 
	import tabBar from '@/components/tabBar.vue'
	import {categoryIndex} from '@/utils/request.js'
	export default {
		data() {
			return {
				showImg:'',
				keyword:'',
								// banner
				currentNum:0,
				currentCity:'西安市',
				banner: [
					'https://cdn.uviewui.com/uview/swiper/swiper2.png',
					'https://cdn.uviewui.com/uview/swiper/swiper3.png',
					'https://cdn.uviewui.com/uview/swiper/swiper1.png',
				], 
				// nav
				navList:[],
			}
		},
		components:{tabBar},
		methods: {
			chooseCity(){
				uni.showToast({
					icon:'loading',
					title:'正在研发中...'
				})
			},
			// head search
			search(){ 
				if(!this.keyword.trim()){
					uni.showToast({
						icon:'none',
						title:'请输入关键词',
						duration:2000
					})
				}else{
					uni.navigateTo({
						url:`/pagesB/annualMeeting/product?keywords=${this.keyword}`
					})
				} 
			},
			// 首页category 轮播导航
			async categoryIndex(){
				return await categoryIndex()
			},
			getCategory(){
				this.categoryIndex().then(res=>{ 
					this.navList=[res.menu] 
				}).catch(err=>{
					console.log(err)
				})
			},
			toFound(item){
				console.log(item)
				if(item.cat_url=='case'){
					uni.navigateTo({
						url:`/pagesB/annualMeeting/case?id=${item.id}`
					})
				}else{
					uni.navigateTo({
						url:`/pagesB/annualMeeting/${item.cat_url}?id=${item.id}`
					})
				} 
			},
		},
		onLoad() {
			this.showImg=this.$config.showImgApi;
			this.getCategory(); 
		}
	}
</script>

<style lang="scss">
.indicator-num {
	        padding: 4rpx 18rpx 6rpx;
	        background-color: rgba(0, 0, 0, 0.35);
	        border-radius: 22rpx;
	        width: 80rpx;
	        @include flex;
	        justify-content: center;
	
	        &__text {
	             color: #FFFFFF; 
				font-size: 26rpx;
	         }
	    } 
		.header{
			background: #FFB850;
			width: 750rpx;
			height: 88rpx;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 90;
			.head{
				@include flex_style(space-between,center,row nowrap);
				padding: 16rpx 22rpx 16rpx 30rpx;
				.local{
					@include flex_style(flex-start,center,row nowrap);
					text{
						display: block;
						max-width: 85rpx;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
						font-size: 28rpx;
						font-family: 苹方-简;
						font-weight: normal;
						line-height: 38rpx;
						color: #FFFFFF;
					}
					.trang{
						width: 0;
						height: 0;
						border-left: 7rpx solid transparent;
						border-right: 7rpx solid transparent;
						border-top: 10rpx solid #FFFFFF;
						margin-left: 8rpx;
					}
				}
				.search{
					width: 580rpx;
					height: 56rpx;
					::v-deep.u-search__content{
						background-color: #F5F5F5!important;
						border-width:0;
					}
					::v-deep.u-search__content__input{
						height: 56rpx!important;
						background-color: #F5F5F5!important;
						border-width:0;
					}
				}  
			}
		}
		.content{
			padding-top: 88rpx;
			padding-bottom: 20rpx;
			.navBar{
				padding: 40rpx;
				swiper{
					height: 500rpx;
					swiper-item{
						@include flex_style(flex-start,center,row wrap);
						.swiper-item{
							@include flex_style(flex-start,center,column wrap);
							margin-bottom: 34rpx;
							// margin-right: 52rpx;
							width: 20%;
							image{
								width: 92rpx;
								height: 92rpx;
							}
							text{
								font-size: 28rpx;
								font-family: 苹方-简;
								font-weight: normal;
								line-height: 38rpx;
								color: #333333;
								white-space: nowrap;
							}
						}
						.swiper-item:nth-child(5n){
							margin-right: 0;
						}
					}
					/* 默认指示点的样式 */
					 .wx-swiper-dot {
					  background-color: #F5F5F5;
					  position: relative;
					  bottom: -20rpx;
					} 
					/* 选中指示点的样式 */
					 .wx-swiper-dot.wx-swiper-dot-active {
						 background-color: #FFB850;
					} 
				} 
			}
	.selec{
		border-top: 16rpx solid #F5F5F5;
		border-bottom: 2rpx solid #F5F5F5;
		padding: 32rpx 48rpx;
		@include flex_style(space-between,center,row nowrap);
		.item{
			@include flex_style(flex-start,center,row nowrap);
			text{
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 400;
				line-height: 40rpx;
				color: #1A1A1A;
			}
			image{
				width: 20rpx;
				height: 10rpx;
				margin-left: 12rpx;
			}
		}
	}
}
.goodsList{
	padding: 0 30rpx 30rpx;
	background-color: #FFFFFF;
	.item{
		border-bottom: 2rpx solid #F5F5F5;
		padding-top: 24rpx;
		padding-bottom: 34rpx;
		@include flex_style(space-between,center,row nowrap);
		image{
			width: 256rpx;
			height: 208rpx;
		}
		.info{
			.name{
				width: 416rpx;
				height: 72rpx;
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: bold;
				line-height: 36rpx;
				color: #1A1A1A;
				@include word_over(2);
				margin-bottom: 12rpx;
			}
			.time{
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 400;
				line-height: 34rpx;
				color: #888888;
				margin-bottom: 12rpx;
			}
			.bottom{
				@include flex_style(space-between,center,row nowrap);
				text{
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					line-height: 34rpx;
					color: #FF6F00;
				}
				.btn{
					width: 144rpx;
					height: 48rpx;
					background: linear-gradient(98deg, #FFB850 0%, #FF8000 100%); 
					border-radius: 24rpx;
					line-height: 48rpx;
					text-align: center;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 400; 
					color: #FFFFFF;
				}
			}
		}
	}
}		
		
</style>
